package ken.spring.cloud.alibaba;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <ul>
 * <li>Title: RockectController</li>
 * <li>Description: TODO </li>
 * </ul>
 *
 * @author swc
 * @date 2022-07-07 15:58
 */
@RestController
public class RockectController {

    @Autowired
    private MqSendService mqSendService;

    //http://localhost:28081/msg?msg=保卫地球
    @RequestMapping("/msg")
    public boolean sendMsg(@RequestParam("msg") String msg) throws Exception{
        mqSendService.sendMsg(msg);
        return true;
    }

    //http://localhost:28081/msgTags?msg=保卫地球1&&tag=myTag
    @RequestMapping("/msgTags")
    public boolean sendMsgTags(@RequestParam("msg") String msg,@RequestParam("tag") String tag)throws Exception{
        mqSendService.sendMsgTags(msg,tag);
        return true;
    }

    //http://localhost:28081/msgTranction?msg=支持事务1&&num=1
    @RequestMapping("/msgTranction")
    public boolean sendMsgTags(@RequestParam("msg") String msg,@RequestParam("num") int num)throws Exception{
        mqSendService.sendTransactionalMsg(msg,num);
        return true;
    }



}
